package com.lhy.controller;


import com.lhy.entity.Student;
import com.lhy.service.impl.StudentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 学生表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-03-09
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    StudentServiceImpl studentService;

    @RequestMapping("/indexs")
    public String toIndex(Model model){
        List<Student> studentList = studentService.findAll();
        model.addAttribute("students", studentList);
        return "index";
    }
}
